package com.rocching.easychat.service;

import com.rocching.easychat.core.IApiCallback;
import com.rocching.easychat.model.GroupListModel;
import com.rocching.easychat.model.GroupModel;
import com.rocching.easychat.model.MyGroupListModel;
import com.rocching.easychat.service.dto.CreateGroupInput;
import com.rocching.easychat.util.HttpUtil;

public class GroupService {
    private static GroupService instance;

    public static GroupService getInstance() {
        if (instance == null) {
            instance = new GroupService();
        }
        return instance;
    }

    public void getMyGroupList(IApiCallback<MyGroupListModel> callback) {
        HttpUtil.get("/api/RCGroup/GetMyGroupList", callback, MyGroupListModel.class);
    }

    public void getGroupInfo(long groupId, IApiCallback<GroupModel> callback) {
        HttpUtil.get(String.format("/api/RCGroup/GetGroupInfo/%s", groupId), callback, GroupModel.class);
    }

    public void createGroup(CreateGroupInput input, IApiCallback<Object> callback) {
        HttpUtil.post("/api/RCGroup/Create", input, callback, Object.class);
    }
}
